@teamix/pro 1.2.9 → 1.2.13
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 +1 -1
- package/dist/pro.css +1 -1
- package/dist/pro.js +2103 -993
- package/dist/pro.min.css +1 -1
- package/dist/pro.min.js +1 -1
- package/es/actions/base.d.ts +16 -6
- package/es/actions/base.js +66 -12
- package/es/actions/confirm.d.ts +1 -1
- package/es/actions/danger-confirm.d.ts +1 -1
- package/es/actions/dialog-component.d.ts +1 -1
- package/es/actions/dialog-form.d.ts +1 -1
- package/es/actions/dialog-form.js +2 -2
- package/es/actions/dialog-info.d.ts +1 -1
- package/es/actions/dialog-table.d.ts +1 -1
- package/es/actions/dialog.d.ts +6 -2
- package/es/actions/dialog.js +9 -5
- package/es/actions/drawer-form.d.ts +1 -1
- package/es/actions/drawer-info.d.ts +1 -1
- package/es/actions/drawer-table.d.ts +1 -1
- package/es/actions/drawer.d.ts +1 -1
- package/es/actions/error.d.ts +1 -1
- package/es/actions/index.js +9 -5
- package/es/actions/index.scss +28 -7
- package/es/actions/link.d.ts +2 -2
- package/es/actions/link.js +2 -2
- package/es/actions/notice.d.ts +1 -1
- package/es/actions/request.d.ts +1 -1
- package/es/actions/request.js +2 -2
- package/es/card/index.d.ts +10 -1
- package/es/card/index.js +20 -5
- package/es/card/index.scss +19 -0
- package/es/card/tab.d.ts +6 -0
- package/es/card/tab.js +27 -0
- package/es/form/Filter/index.d.ts +2 -5
- package/es/form/Filter/index.js +3 -44
- package/es/form/Filter/index.scss +71 -0
- package/es/form/Filter/index2.d.ts +8 -0
- package/es/form/Filter/index2.js +318 -0
- package/es/form/ProForm/index.js +3 -23
- package/es/form/ProForm/index.scss +10 -19
- package/es/form/ProForm/useFormDisplayValues.d.ts +3 -5
- package/es/form/ProForm/useFormDisplayValues.js +44 -38
- package/es/form/SchemaForm/index.js +7 -6
- package/es/form/index.d.ts +11 -10
- package/es/form/index.js +3 -2
- package/es/form/typing.d.ts +3 -0
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/info/components/ProInfoItem/index.js +3 -1
- package/es/nocode/pages/renderer.d.ts +2 -2
- package/es/page-header/index.d.ts +20 -11
- package/es/page-header/index.js +23 -47
- package/es/page-header/index.scss +0 -11
- package/es/table/components/Filter/index.js +11 -9
- package/es/table/components/Filter/index.scss +7 -3
- package/es/table/components/Layout/index.js +10 -1
- package/es/table/index.js +21 -11
- package/es/table/typing.d.ts +6 -0
- package/es/table/utils/columnRender.js +38 -1
- package/es/table/utils/index.js +15 -1
- package/es/utils/components/tags/index.d.ts +15 -0
- package/es/utils/components/tags/index.js +94 -0
- package/es/utils/components/tags/index.scss +12 -0
- package/lib/actions/base.d.ts +16 -6
- package/lib/actions/base.js +67 -12
- package/lib/actions/confirm.d.ts +1 -1
- package/lib/actions/danger-confirm.d.ts +1 -1
- package/lib/actions/dialog-component.d.ts +1 -1
- package/lib/actions/dialog-form.d.ts +1 -1
- package/lib/actions/dialog-form.js +2 -2
- package/lib/actions/dialog-info.d.ts +1 -1
- package/lib/actions/dialog-table.d.ts +1 -1
- package/lib/actions/dialog.d.ts +6 -2
- package/lib/actions/dialog.js +9 -5
- package/lib/actions/drawer-form.d.ts +1 -1
- package/lib/actions/drawer-info.d.ts +1 -1
- package/lib/actions/drawer-table.d.ts +1 -1
- package/lib/actions/drawer.d.ts +1 -1
- package/lib/actions/error.d.ts +1 -1
- package/lib/actions/index.js +9 -5
- package/lib/actions/index.scss +28 -7
- package/lib/actions/link.d.ts +2 -2
- package/lib/actions/link.js +2 -2
- package/lib/actions/notice.d.ts +1 -1
- package/lib/actions/request.d.ts +1 -1
- package/lib/actions/request.js +2 -2
- package/lib/card/index.d.ts +10 -1
- package/lib/card/index.js +22 -4
- package/lib/card/index.scss +19 -0
- package/lib/card/tab.d.ts +6 -0
- package/lib/card/tab.js +39 -0
- package/lib/form/Filter/index.d.ts +2 -5
- package/lib/form/Filter/index.js +4 -45
- package/lib/form/Filter/index.scss +71 -0
- package/lib/form/Filter/index2.d.ts +8 -0
- package/lib/form/Filter/index2.js +342 -0
- package/lib/form/ProForm/index.js +3 -23
- package/lib/form/ProForm/index.scss +10 -19
- package/lib/form/ProForm/useFormDisplayValues.d.ts +3 -5
- package/lib/form/ProForm/useFormDisplayValues.js +51 -44
- package/lib/form/SchemaForm/index.js +7 -6
- package/lib/form/index.d.ts +11 -10
- package/lib/form/index.js +5 -3
- package/lib/form/typing.d.ts +3 -0
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/info/components/ProInfoItem/index.js +3 -1
- package/lib/nocode/pages/renderer.d.ts +2 -2
- package/lib/page-header/index.d.ts +20 -11
- package/lib/page-header/index.js +22 -45
- package/lib/page-header/index.scss +0 -11
- package/lib/table/components/Filter/index.js +10 -8
- package/lib/table/components/Filter/index.scss +7 -3
- package/lib/table/components/Layout/index.js +10 -1
- package/lib/table/index.js +20 -10
- package/lib/table/typing.d.ts +6 -0
- package/lib/table/utils/columnRender.js +38 -1
- package/lib/table/utils/index.js +15 -1
- package/lib/utils/components/tags/index.d.ts +15 -0
- package/lib/utils/components/tags/index.js +114 -0
- package/lib/utils/components/tags/index.scss +12 -0
- package/package.json +4 -4
@@ -15,51 +15,57 @@ import { isArr, isPlainObj, getValueByValue } from '@teamix/utils';
|
|
15
15
|
/**
|
16
16
|
* 获取表单值的可显示值
|
17
17
|
* @returns 如果某字段有dataSource,则返回value对应label
|
18
|
+
* @example const example = {
|
19
|
+
a: [
|
20
|
+
[{ b: 'a.0.0.b', c: 'a.0.0.c' }, { d: 'a.0.1.d' }],
|
21
|
+
{ e: [{ f: { g: [{ h: 'a.1.e.0.f.g.0.h' }] } }, 'a.1.e.1'] },
|
22
|
+
],
|
23
|
+
};
|
24
|
+
console.log(getDisplayValues(example));
|
18
25
|
*/
|
19
26
|
|
20
|
-
var
|
21
|
-
var
|
22
|
-
var
|
27
|
+
var getDisplayValues = function getDisplayValues(form, values) {
|
28
|
+
var prefix = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
|
29
|
+
var displayValues; // 判断值的类型,递归获取每个值在该结构中的完整路径
|
23
30
|
|
24
|
-
|
25
|
-
|
26
|
-
|
31
|
+
if (isPlainObj(values)) {
|
32
|
+
displayValues = {};
|
33
|
+
Object.entries(values).forEach(function (_ref) {
|
34
|
+
var _ref2 = _slicedToArray(_ref, 2),
|
35
|
+
key = _ref2[0],
|
36
|
+
value = _ref2[1];
|
27
37
|
|
28
|
-
|
29
|
-
displayValues =
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
value = _ref2[1];
|
38
|
+
var path = prefix ? "".concat(prefix, ".").concat(key) : "".concat(key);
|
39
|
+
displayValues[key] = getDisplayValues(form, value, path);
|
40
|
+
});
|
41
|
+
} else if (isArr(values)) {
|
42
|
+
displayValues = []; // todo 如果对象或数组的值不再是对象或数组,并且找不到路径,判断为非复合组件,直接返回原始值
|
34
43
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
}
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
}
|
44
|
+
values.map(function (value, index) {
|
45
|
+
var path = prefix ? "".concat(prefix, ".").concat(index) : "".concat(index);
|
46
|
+
displayValues[index] = getDisplayValues(form, value, path);
|
47
|
+
});
|
48
|
+
} else {
|
49
|
+
// 通过值的完整路径获取字段address(从form实例的indexes中),然后获取该字段的value在该字段dataSource中对应的label
|
50
|
+
var address = form.indexes[prefix];
|
51
|
+
var field = form.query(address).take();
|
52
|
+
displayValues = {
|
53
|
+
title: field === null || field === void 0 ? void 0 : field.title,
|
54
|
+
value: values,
|
55
|
+
displayValue: getValueByValue(field === null || field === void 0 ? void 0 : field.dataSource, values)
|
56
|
+
};
|
57
|
+
}
|
50
58
|
|
51
|
-
|
52
|
-
|
53
|
-
// const example = {
|
54
|
-
// a: [
|
55
|
-
// [{ b: 'a.0.0.b', c: 'a.0.0.c' }, { d: 'a.0.1.d' }],
|
56
|
-
// { e: [{ f: { g: [{ h: 'a.1.e.0.f.g.0.h' }] } }, 'a.1.e.1'] },
|
57
|
-
// ],
|
58
|
-
// };
|
59
|
-
// console.log(getDisplayValues(example));
|
59
|
+
return displayValues;
|
60
|
+
};
|
60
61
|
|
62
|
+
var useFormDisplayValues = function useFormDisplayValues() {
|
63
|
+
var form = useForm();
|
64
|
+
return getDisplayValues(form, form.values);
|
65
|
+
};
|
61
66
|
|
62
|
-
|
67
|
+
var getFormDisplayValues = function getFormDisplayValues(form) {
|
68
|
+
return getDisplayValues(form, form.values);
|
63
69
|
};
|
64
70
|
|
65
|
-
export
|
71
|
+
export { useFormDisplayValues, getFormDisplayValues };
|
@@ -62,6 +62,7 @@ export default /*#__PURE__*/memo(function (_ref) {
|
|
62
62
|
var schema = _ref.schema,
|
63
63
|
scope = _ref.scope,
|
64
64
|
components = _ref.components;
|
65
|
+
// 创建 SchemaField
|
65
66
|
var SchemaField = useMemo(function () {
|
66
67
|
return createSchemaField({
|
67
68
|
components: _objectSpread(_objectSpread({}, ProFieldComponents), {}, {
|
@@ -92,15 +93,15 @@ export default /*#__PURE__*/memo(function (_ref) {
|
|
92
93
|
Text: Text
|
93
94
|
})
|
94
95
|
});
|
95
|
-
}, []); // 合并schema中request的scope
|
96
|
+
}, []); // 合并 schema 中 request 的 scope
|
96
97
|
|
97
98
|
var mergedScope = useMemo(function () {
|
98
99
|
return _objectSpread({}, scope);
|
99
|
-
}, [scope]); // 格式化schema
|
100
|
+
}, [scope]); // 格式化 schema
|
100
101
|
|
101
102
|
var formatSchema = useCallback(function (schema) {
|
102
103
|
var schemaProperties = {};
|
103
|
-
schema.forEach(function (item) {
|
104
|
+
schema === null || schema === void 0 ? void 0 : schema.forEach(function (item) {
|
104
105
|
var newItem = warning(item);
|
105
106
|
var _newItem = newItem,
|
106
107
|
originalComponent = _newItem.component; // 根据component的不同,初始化为内置的item
|
@@ -236,15 +237,15 @@ export default /*#__PURE__*/memo(function (_ref) {
|
|
236
237
|
});
|
237
238
|
return schemaProperties;
|
238
239
|
}, [mergedScope]);
|
239
|
-
var
|
240
|
+
var proFormSchema = useMemo(function () {
|
240
241
|
return {
|
241
242
|
type: 'object',
|
242
243
|
properties: formatSchema(schema)
|
243
244
|
};
|
244
|
-
}, []); // console.log(
|
245
|
+
}, []); // console.log(proFormSchema);
|
245
246
|
|
246
247
|
return /*#__PURE__*/React.createElement(SchemaField, {
|
247
|
-
schema:
|
248
|
+
schema: proFormSchema,
|
248
249
|
components: components,
|
249
250
|
scope: mergedScope
|
250
251
|
});
|
package/es/form/index.d.ts
CHANGED
@@ -35,39 +35,39 @@ declare const formilyReact: {
|
|
35
35
|
<Decorator extends originalFormilyReact.JSXComponent, Component extends originalFormilyReact.JSXComponent>(props: originalFormilyReact.ISchemaFieldProps<Decorator, Component, import("@formily/core").ObjectField<Decorator, Component>>): JSX.Element;
|
36
36
|
displayName: string;
|
37
37
|
Markup: {
|
38
|
-
<Decorator_1 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "
|
38
|
+
<Decorator_1 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "propTypes" | "contextTypes" | "defaultProps" | "displayName">>, Component_1 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "propTypes" | "contextTypes" | "defaultProps" | "displayName">>>(props: originalFormilyReact.ISchemaMarkupFieldProps<Components, Component_1, Decorator_1>): JSX.Element;
|
39
39
|
displayName: string;
|
40
40
|
};
|
41
41
|
String: {
|
42
|
-
<Decorator_2 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "
|
42
|
+
<Decorator_2 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "propTypes" | "contextTypes" | "defaultProps" | "displayName">>, Component_2 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "propTypes" | "contextTypes" | "defaultProps" | "displayName">>>(props: originalFormilyReact.ISchemaTypeFieldProps<Components, Component_2, Decorator_2>): JSX.Element;
|
43
43
|
displayName: string;
|
44
44
|
};
|
45
45
|
Object: {
|
46
|
-
<Decorator_3 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "
|
46
|
+
<Decorator_3 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "propTypes" | "contextTypes" | "defaultProps" | "displayName">>, Component_3 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "propTypes" | "contextTypes" | "defaultProps" | "displayName">>>(props: originalFormilyReact.ISchemaTypeFieldProps<Components, Component_3, Decorator_3>): JSX.Element;
|
47
47
|
displayName: string;
|
48
48
|
};
|
49
49
|
Array: {
|
50
|
-
<Decorator_4 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "
|
50
|
+
<Decorator_4 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "propTypes" | "contextTypes" | "defaultProps" | "displayName">>, Component_4 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "propTypes" | "contextTypes" | "defaultProps" | "displayName">>>(props: originalFormilyReact.ISchemaTypeFieldProps<Components, Component_4, Decorator_4>): JSX.Element;
|
51
51
|
displayName: string;
|
52
52
|
};
|
53
53
|
Boolean: {
|
54
|
-
<Decorator_5 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "
|
54
|
+
<Decorator_5 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "propTypes" | "contextTypes" | "defaultProps" | "displayName">>, Component_5 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "propTypes" | "contextTypes" | "defaultProps" | "displayName">>>(props: originalFormilyReact.ISchemaTypeFieldProps<Components, Component_5, Decorator_5>): JSX.Element;
|
55
55
|
displayName: string;
|
56
56
|
};
|
57
57
|
Date: {
|
58
|
-
<Decorator_6 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "
|
58
|
+
<Decorator_6 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "propTypes" | "contextTypes" | "defaultProps" | "displayName">>, Component_6 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "propTypes" | "contextTypes" | "defaultProps" | "displayName">>>(props: originalFormilyReact.ISchemaTypeFieldProps<Components, Component_6, Decorator_6>): JSX.Element;
|
59
59
|
displayName: string;
|
60
60
|
};
|
61
61
|
DateTime: {
|
62
|
-
<Decorator_7 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "
|
62
|
+
<Decorator_7 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "propTypes" | "contextTypes" | "defaultProps" | "displayName">>, Component_7 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "propTypes" | "contextTypes" | "defaultProps" | "displayName">>>(props: originalFormilyReact.ISchemaTypeFieldProps<Components, Component_7, Decorator_7>): JSX.Element;
|
63
63
|
displayName: string;
|
64
64
|
};
|
65
65
|
Void: {
|
66
|
-
<Decorator_8 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "
|
66
|
+
<Decorator_8 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "propTypes" | "contextTypes" | "defaultProps" | "displayName">>, Component_8 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "propTypes" | "contextTypes" | "defaultProps" | "displayName">>>(props: originalFormilyReact.ISchemaTypeFieldProps<Components, Component_8, Decorator_8>): JSX.Element;
|
67
67
|
displayName: string;
|
68
68
|
};
|
69
69
|
Number: {
|
70
|
-
<Decorator_9 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "
|
70
|
+
<Decorator_9 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "propTypes" | "contextTypes" | "defaultProps" | "displayName">>, Component_9 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "propTypes" | "contextTypes" | "defaultProps" | "displayName">>>(props: originalFormilyReact.ISchemaTypeFieldProps<Components, Component_9, Decorator_9>): JSX.Element;
|
71
71
|
displayName: string;
|
72
72
|
};
|
73
73
|
};
|
@@ -108,7 +108,8 @@ export { createForm, FormConsumer, FormDialog, FormDrawer, FormStep, FormTab, Fo
|
|
108
108
|
/**
|
109
109
|
* 导出 Filter 组件
|
110
110
|
*/
|
111
|
-
import { AdvancedFilter, SimpleFilter
|
111
|
+
import { AdvancedFilter, SimpleFilter } from './Filter';
|
112
|
+
import { QueryFilter } from './Filter/index2';
|
112
113
|
export { AdvancedFilter, SimpleFilter, QueryFilter };
|
113
114
|
/**
|
114
115
|
* 导出 ProForm 组件,支持快速搭建表单
|
package/es/form/index.js
CHANGED
@@ -19,7 +19,7 @@ export { _formilyReactive as formilyReactive };
|
|
19
19
|
import * as _formilyTeamix from '@teamix/formily';
|
20
20
|
export { _formilyTeamix as formilyTeamix };
|
21
21
|
import * as originalFormilyReact from '@formily/react';
|
22
|
-
import useFormDisplayValues from './ProForm/useFormDisplayValues';
|
22
|
+
import { useFormDisplayValues } from './ProForm/useFormDisplayValues';
|
23
23
|
import useFieldRequest from './ProForm/useFieldRequest';
|
24
24
|
|
25
25
|
var formilyReact = _objectSpread(_objectSpread({}, originalFormilyReact), {}, {
|
@@ -40,7 +40,8 @@ export { createForm, FormConsumer, FormDialog, FormDrawer, FormStep, FormTab, Fo
|
|
40
40
|
* 导出 Filter 组件
|
41
41
|
*/
|
42
42
|
|
43
|
-
import { AdvancedFilter, SimpleFilter
|
43
|
+
import { AdvancedFilter, SimpleFilter } from './Filter';
|
44
|
+
import { QueryFilter } from './Filter/index2';
|
44
45
|
export { AdvancedFilter, SimpleFilter, QueryFilter };
|
45
46
|
/**
|
46
47
|
* 导出 ProForm 组件,支持快速搭建表单
|
package/es/form/typing.d.ts
CHANGED
@@ -2,6 +2,7 @@ import type { ReactNode } from 'react';
|
|
2
2
|
import type { IFormFeedback, Form as FormType, FieldPatternTypes } from '@formily/core';
|
3
3
|
import type { IFormLayoutProps } from '@teamix/formily';
|
4
4
|
import { CommonRequestConfig } from '@teamix/utils';
|
5
|
+
import React from 'react';
|
5
6
|
interface AnyObject {
|
6
7
|
[propName: string]: any;
|
7
8
|
}
|
@@ -64,6 +65,8 @@ export interface ProFormProps extends IFormLayoutProps {
|
|
64
65
|
onSubmitFailed?: (feedbacks: IFormFeedback[]) => void;
|
65
66
|
}
|
66
67
|
export interface QueryFilterProps extends ProFormProps {
|
68
|
+
addonBefore?: ReactNode;
|
69
|
+
addonAfter?: ReactNode;
|
67
70
|
onFilter?: (values: any) => void;
|
68
71
|
onReset?: (payload?: any) => void;
|
69
72
|
}
|
package/es/index.d.ts
CHANGED
@@ -21,5 +21,5 @@ export * from './page-container';
|
|
21
21
|
export * from './page-header';
|
22
22
|
export * from './skeleton';
|
23
23
|
export * from './table';
|
24
|
-
declare const version = "1.2.
|
24
|
+
declare const version = "1.2.12";
|
25
25
|
export { version, ProAction, ProCard, ProField, ProForm, ProInfo, ProPageContainer, ProPageHeader, ProSkeleton, ProTable, hooks, nocode, templates, utils, };
|
package/es/index.js
CHANGED
@@ -27,7 +27,7 @@ export * from './page-header';
|
|
27
27
|
export * from './skeleton';
|
28
28
|
export * from './table'; // export * from './sidebar';
|
29
29
|
|
30
|
-
var version = '1.2.
|
30
|
+
var version = '1.2.12';
|
31
31
|
export { version, ProAction, ProCard, ProField, ProForm, ProInfo, // ProLayout,
|
32
32
|
ProPageContainer, ProPageHeader, ProSkeleton, ProTable, // ProSidebar,
|
33
33
|
hooks, nocode, templates, utils };
|
@@ -21,7 +21,9 @@ var ProInfoItem = function ProInfoItem(prop) {
|
|
21
21
|
wrapperCol = baseInfoLayout.wrapperCol;
|
22
22
|
return /*#__PURE__*/React.createElement("div", {
|
23
23
|
className: cls()
|
24
|
-
}, /*#__PURE__*/React.createElement(Row,
|
24
|
+
}, /*#__PURE__*/React.createElement(Row, {
|
25
|
+
gutter: 10
|
26
|
+
}, /*#__PURE__*/React.createElement(Col, {
|
25
27
|
span: labelCol === null || labelCol === void 0 ? void 0 : labelCol.span,
|
26
28
|
className: cls('label')
|
27
29
|
}, /*#__PURE__*/React.createElement(Ellipsis, {
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { PageProps } from '../../page-container';
|
2
|
-
import { PageMap
|
2
|
+
import { PageMap } from '.';
|
3
3
|
export interface PageRendererProps<T = any> extends PageProps<T> {
|
4
|
-
type?:
|
4
|
+
type?: any;
|
5
5
|
error?: any;
|
6
6
|
title?: string;
|
7
7
|
pageMap?: PageMap;
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import React from 'react';
|
2
|
-
import { TagProps, CloseableProps } from '@alicloudfe/components/types/tag';
|
3
2
|
import { ItemProps } from '@alicloudfe/components/types/breadcrumb';
|
3
|
+
import { LinkPath } from '@teamix/utils';
|
4
|
+
import { ProTagItem } from '../utils/components/tags';
|
4
5
|
import { ProActionGroupProps } from '../actions';
|
5
6
|
import { ProInfoProps } from '../info';
|
6
7
|
import './index.scss';
|
@@ -10,14 +11,7 @@ export interface ProPageHeaderBreadcrumbItem extends ItemProps {
|
|
10
11
|
*/
|
11
12
|
text?: string;
|
12
13
|
}
|
13
|
-
export declare type ProPageHeaderTagItem =
|
14
|
-
closable: true;
|
15
|
-
})) & {
|
16
|
-
/**
|
17
|
-
* @deprecated 建议使用 children 代替
|
18
|
-
*/
|
19
|
-
text?: string;
|
20
|
-
};
|
14
|
+
export declare type ProPageHeaderTagItem = ProTagItem;
|
21
15
|
declare type Color = 'blue' | 'green' | 'orange' | 'red' | 'yellow' | string;
|
22
16
|
export declare type ProPageHeaderDataItem = {
|
23
17
|
title: string;
|
@@ -25,20 +19,35 @@ export declare type ProPageHeaderDataItem = {
|
|
25
19
|
color?: Color;
|
26
20
|
} & React.HTMLAttributes<HTMLElement>;
|
27
21
|
export declare type ProPageHeaderProps = {
|
22
|
+
/** 标题 */
|
28
23
|
title?: React.ReactNode;
|
24
|
+
/** 描述 */
|
29
25
|
description?: React.ReactNode;
|
30
|
-
|
26
|
+
/** 图标 */
|
27
|
+
icon?: React.ReactNode;
|
28
|
+
/** 图标颜色 */
|
31
29
|
iconColor?: Color;
|
30
|
+
/** 图标背景类型 */
|
32
31
|
iconBackgroundType?: 'circle' | 'square';
|
32
|
+
/** 图标背景色 */
|
33
33
|
iconBackgroundColor?: Color;
|
34
|
-
|
34
|
+
/** 返回按钮配置 */
|
35
|
+
goback?: boolean | LinkPath | ((e: React.MouseEvent) => void);
|
36
|
+
/** 背景图 */
|
35
37
|
image?: string;
|
38
|
+
/** 加载中 */
|
36
39
|
loading?: boolean;
|
40
|
+
/** 面包屑配置 */
|
37
41
|
breadcrumb?: ProPageHeaderBreadcrumbItem[];
|
42
|
+
/** 额外信息区配置 */
|
38
43
|
extra?: ProActionGroupProps | React.ReactNode;
|
44
|
+
/** 操作区配置 */
|
39
45
|
operation?: ProActionGroupProps | React.ReactNode;
|
46
|
+
/** 标签组 */
|
40
47
|
tags?: ProPageHeaderTagItem[];
|
48
|
+
/** 数据概览项 */
|
41
49
|
data?: ProPageHeaderDataItem[];
|
50
|
+
/** 底部详情 */
|
42
51
|
info?: ProInfoProps | React.ReactNode;
|
43
52
|
} & Omit<React.HTMLAttributes<HTMLElement>, 'title'>;
|
44
53
|
declare const ProPageHeader: React.FC<ProPageHeaderProps>;
|
package/es/page-header/index.js
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
var _excluded = ["text", "children"],
|
2
|
-
_excluded2 = ["
|
3
|
-
_excluded3 = ["
|
4
|
-
_excluded4 = ["title", "description", "icon", "iconColor", "iconBackgroundType", "iconBackgroundColor", "goback", "operation", "extra", "image", "loading", "breadcrumb", "tags", "data", "info", "children", "className", "style"];
|
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"];
|
5
4
|
|
6
5
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
7
6
|
|
@@ -17,8 +16,9 @@ import React from 'react';
|
|
17
16
|
import { useHistory } from 'react-router-dom';
|
18
17
|
import classnames from 'classnames';
|
19
18
|
import TeamixIcon from '@teamix/icon';
|
20
|
-
import { Breadcrumb
|
21
|
-
import { baseClass } from '@teamix/utils';
|
19
|
+
import { Breadcrumb } from '@alicloudfe/components';
|
20
|
+
import { baseClass, goToLink } from '@teamix/utils';
|
21
|
+
import { renderTags } from '../utils/components/tags';
|
22
22
|
import { ProActionGroup } from '../actions';
|
23
23
|
import { ProSkeletonRaw } from '../skeleton';
|
24
24
|
import ProInfo from '../info';
|
@@ -64,40 +64,6 @@ var renderActionGroup = function renderActionGroup(group, defaultProps) {
|
|
64
64
|
return group;
|
65
65
|
};
|
66
66
|
|
67
|
-
var renderTags = function renderTags(tags) {
|
68
|
-
if (!tags) {
|
69
|
-
return null;
|
70
|
-
}
|
71
|
-
|
72
|
-
return /*#__PURE__*/React.createElement(Tag.Group, {
|
73
|
-
className: cls('tags')
|
74
|
-
}, tags.map(function (tag, i) {
|
75
|
-
// @ts-ignore
|
76
|
-
var text = tag.text,
|
77
|
-
children = tag.children,
|
78
|
-
closable = tag.closable,
|
79
|
-
others = _objectWithoutProperties(tag, _excluded2);
|
80
|
-
|
81
|
-
if (closable) {
|
82
|
-
return /*#__PURE__*/React.createElement(Tag.Closeable, _objectSpread({
|
83
|
-
key: i,
|
84
|
-
size: "large",
|
85
|
-
style: {
|
86
|
-
marginBottom: 0
|
87
|
-
}
|
88
|
-
}, others), text || children);
|
89
|
-
}
|
90
|
-
|
91
|
-
return /*#__PURE__*/React.createElement(Tag, _objectSpread({
|
92
|
-
key: i,
|
93
|
-
size: "large",
|
94
|
-
style: {
|
95
|
-
marginBottom: 0
|
96
|
-
}
|
97
|
-
}, others), text || children);
|
98
|
-
}));
|
99
|
-
};
|
100
|
-
|
101
67
|
var isPresetColor = function isPresetColor(color) {
|
102
68
|
if (!color) {
|
103
69
|
return false;
|
@@ -135,7 +101,7 @@ var renderData = function renderData(data) {
|
|
135
101
|
title = item.title,
|
136
102
|
num = item.num,
|
137
103
|
customClassName = item.className,
|
138
|
-
others = _objectWithoutProperties(item,
|
104
|
+
others = _objectWithoutProperties(item, _excluded2);
|
139
105
|
|
140
106
|
var _getColorAndStyle = getColorAndStyle(color),
|
141
107
|
className = _getColorAndStyle.className,
|
@@ -183,7 +149,7 @@ var ProPageHeader = function ProPageHeader(props) {
|
|
183
149
|
children = props.children,
|
184
150
|
className = props.className,
|
185
151
|
style = props.style,
|
186
|
-
others = _objectWithoutProperties(props,
|
152
|
+
others = _objectWithoutProperties(props, _excluded3);
|
187
153
|
|
188
154
|
var history = useHistory();
|
189
155
|
var backgroundImage = image ? "url('".concat(image, "')") : undefined;
|
@@ -201,12 +167,22 @@ var ProPageHeader = function ProPageHeader(props) {
|
|
201
167
|
iconClass = _getColorAndStyle2.className,
|
202
168
|
iconStyle = _getColorAndStyle2.style;
|
203
169
|
|
204
|
-
var onBack = function onBack() {
|
170
|
+
var onBack = function onBack(e) {
|
171
|
+
if (!goback) {
|
172
|
+
return;
|
173
|
+
}
|
174
|
+
|
175
|
+
if (typeof goback === 'function') {
|
176
|
+
goback(e);
|
177
|
+
return;
|
178
|
+
}
|
179
|
+
|
205
180
|
if (goback === true) {
|
206
181
|
history.go(-1);
|
207
|
-
|
208
|
-
history.push && history.push(goback);
|
182
|
+
return;
|
209
183
|
}
|
184
|
+
|
185
|
+
goToLink(goback, history);
|
210
186
|
};
|
211
187
|
|
212
188
|
return /*#__PURE__*/React.createElement(React.Fragment, null, goback && /*#__PURE__*/React.createElement(TeamixIcon, {
|
@@ -214,14 +190,14 @@ var ProPageHeader = function ProPageHeader(props) {
|
|
214
190
|
onClick: onBack,
|
215
191
|
type: "return-line",
|
216
192
|
size: "large"
|
217
|
-
}), icon && /*#__PURE__*/React.createElement(TeamixIcon, {
|
193
|
+
}), icon && (typeof icon === 'string' ? /*#__PURE__*/React.createElement(TeamixIcon, {
|
218
194
|
className: classnames(iconClass, cls('title-icon')),
|
219
195
|
style: iconStyle,
|
220
196
|
type: icon,
|
221
197
|
size: "large"
|
222
|
-
}), /*#__PURE__*/React.createElement("span", {
|
198
|
+
}) : /*#__PURE__*/React.createElement(React.Fragment, null, icon)), /*#__PURE__*/React.createElement("span", {
|
223
199
|
className: cls('title-name')
|
224
|
-
}, title), renderTags(tags));
|
200
|
+
}, title), renderTags(tags, 'large'));
|
225
201
|
};
|
226
202
|
|
227
203
|
return /*#__PURE__*/React.createElement("header", _objectSpread({
|
@@ -124,17 +124,6 @@ $prefix: 'teamix-pro-page-header';
|
|
124
124
|
cursor: pointer;
|
125
125
|
}
|
126
126
|
|
127
|
-
.#{$prefix}-tags {
|
128
|
-
display: inline-flex;
|
129
|
-
align-items: center;
|
130
|
-
|
131
|
-
& > div {
|
132
|
-
&:last-child {
|
133
|
-
margin-right: 0;
|
134
|
-
}
|
135
|
-
}
|
136
|
-
}
|
137
|
-
|
138
127
|
.#{$prefix}-color {
|
139
128
|
&-blue {
|
140
129
|
color: var(--color-notice-5);
|
@@ -27,7 +27,7 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
27
27
|
import React, { useEffect, useMemo, useState } from 'react';
|
28
28
|
import TeamixIcon from '@teamix/icon';
|
29
29
|
import { Button, Dropdown, Menu } from '@alicloudfe/components';
|
30
|
-
import { baseClass } from '@teamix/utils';
|
30
|
+
import { baseClass, getMessage } from '@teamix/utils';
|
31
31
|
import './index.scss';
|
32
32
|
var CheckboxItem = Menu.CheckboxItem;
|
33
33
|
var cls = baseClass('teamix-pro-table-toolbar-filter');
|
@@ -171,7 +171,7 @@ var Filter = function Filter(props) {
|
|
171
171
|
btn: true
|
172
172
|
}),
|
173
173
|
onClick: function onClick() {
|
174
|
-
var _actionRef$current2, _actionRef$current2$f, _actionRef$current$ge5, _actionRef$current3, _actionRef$current3$g, _actionRef$current3$g2, _actionRef$current4, _actionRef$current5, _actionRef$current5$s, _actionRef$current6, _actionRef$current6$r, _actionRef$current7, _actionRef$current7$r;
|
174
|
+
var _actionRef$current2, _actionRef$current2$f, _actionRef$current$ge5, _actionRef$current3, _actionRef$current3$g, _actionRef$current3$g2, _actionRef$current4, _actionRef$current5, _actionRef$current5$s, _actionRef$current6, _actionRef$current6$r, _actionRef$current7, _actionRef$current7$r, _actionRef$current8, _actionRef$current8$c;
|
175
175
|
|
176
176
|
(_actionRef$current2 = actionRef.current) === null || _actionRef$current2 === void 0 ? void 0 : (_actionRef$current2$f = _actionRef$current2.filterDataSource) === null || _actionRef$current2$f === void 0 ? void 0 : _actionRef$current2$f.call(_actionRef$current2, column.dataIndex); // 先获取此列的param
|
177
177
|
|
@@ -214,27 +214,29 @@ var Filter = function Filter(props) {
|
|
214
214
|
}))); // 发送请求
|
215
215
|
|
216
216
|
(_actionRef$current6 = actionRef.current) === null || _actionRef$current6 === void 0 ? void 0 : (_actionRef$current6$r = _actionRef$current6.request) === null || _actionRef$current6$r === void 0 ? void 0 : _actionRef$current6$r.call(_actionRef$current6, _objectSpread(_objectSpread({}, params), {}, _defineProperty({}, targetPageKey, 1)));
|
217
|
-
(_actionRef$current7 = actionRef.current) === null || _actionRef$current7 === void 0 ? void 0 : (_actionRef$current7$r = _actionRef$current7.resetPage) === null || _actionRef$current7$r === void 0 ? void 0 : _actionRef$current7$r.call(_actionRef$current7);
|
217
|
+
(_actionRef$current7 = actionRef.current) === null || _actionRef$current7 === void 0 ? void 0 : (_actionRef$current7$r = _actionRef$current7.resetPage) === null || _actionRef$current7$r === void 0 ? void 0 : _actionRef$current7$r.call(_actionRef$current7); // 清空表格选择
|
218
|
+
|
219
|
+
(_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);
|
218
220
|
setVisible(false);
|
219
221
|
}
|
220
|
-
},
|
222
|
+
}, getMessage('ok')), /*#__PURE__*/React.createElement(Button, {
|
221
223
|
type: "normal",
|
222
224
|
size: "small",
|
223
225
|
className: cls({
|
224
226
|
btn: true
|
225
227
|
}),
|
226
228
|
onClick: function onClick() {
|
227
|
-
var _actionRef$current$ge6, _actionRef$
|
229
|
+
var _actionRef$current$ge6, _actionRef$current9, _actionRef$current9$g, _actionRef$current9$g2, _actionRef$current10, _actionRef$current10$, _actionRef$current11, _actionRef$current11$;
|
228
230
|
|
229
231
|
setSelected([]);
|
230
|
-
var rules = (_actionRef$current$ge6 = (_actionRef$
|
231
|
-
(_actionRef$
|
232
|
+
var rules = (_actionRef$current$ge6 = (_actionRef$current9 = actionRef.current) === null || _actionRef$current9 === void 0 ? void 0 : (_actionRef$current9$g = _actionRef$current9.getState) === null || _actionRef$current9$g === void 0 ? void 0 : (_actionRef$current9$g2 = _actionRef$current9$g.call(_actionRef$current9)) === null || _actionRef$current9$g2 === void 0 ? void 0 : _actionRef$current9$g2.filterRules) !== null && _actionRef$current$ge6 !== void 0 ? _actionRef$current$ge6 : {};
|
233
|
+
(_actionRef$current10 = actionRef.current) === null || _actionRef$current10 === void 0 ? void 0 : (_actionRef$current10$ = _actionRef$current10.setFilterRules) === null || _actionRef$current10$ === void 0 ? void 0 : _actionRef$current10$.call(_actionRef$current10, _objectSpread(_objectSpread({}, rules), {}, _defineProperty({}, column.dataIndex, {
|
232
234
|
rules: [],
|
233
235
|
params: ''
|
234
236
|
})));
|
235
|
-
(_actionRef$
|
237
|
+
(_actionRef$current11 = actionRef.current) === null || _actionRef$current11 === void 0 ? void 0 : (_actionRef$current11$ = _actionRef$current11.filterDataSource) === null || _actionRef$current11$ === void 0 ? void 0 : _actionRef$current11$.call(_actionRef$current11, column.dataIndex); // setVisible(!visible);
|
236
238
|
}
|
237
|
-
},
|
239
|
+
}, getMessage('reset'))))));
|
238
240
|
};
|
239
241
|
|
240
242
|
export default Filter;
|
@@ -12,12 +12,16 @@
|
|
12
12
|
}
|
13
13
|
.teamix-pro-table-toolbar-filter-btn-box {
|
14
14
|
display: flex;
|
15
|
-
justify-content:
|
15
|
+
justify-content: center;
|
16
16
|
margin-top: 10px;
|
17
17
|
padding-bottom: 5px;
|
18
|
+
padding-left: 4px;
|
19
|
+
padding-right: 4px;
|
18
20
|
}
|
19
21
|
.teamix-pro-table-toolbar-filter-btn.teamix-pro-table-toolbar-filter-btn {
|
20
|
-
width: 48px !important;
|
21
|
-
|
22
|
+
min-width: 48px !important;
|
23
|
+
&:first-child {
|
24
|
+
margin-right: 8px;
|
25
|
+
}
|
22
26
|
}
|
23
27
|
}
|
@@ -70,7 +70,16 @@ var Layout = function Layout(props) {
|
|
70
70
|
var _mainAction$actions;
|
71
71
|
|
72
72
|
if (_typeof(mainAction) === 'object' && (mainAction === null || mainAction === void 0 ? void 0 : (_mainAction$actions = mainAction.actions) === null || _mainAction$actions === void 0 ? void 0 : _mainAction$actions.length) > 0) {
|
73
|
-
//
|
73
|
+
// 判断 actions 是否 visible 都为 false,是的话也不渲染
|
74
|
+
var isEmptyActions = mainAction === null || mainAction === void 0 ? void 0 : mainAction.actions.every(function (action) {
|
75
|
+
return (action === null || action === void 0 ? void 0 : action.visible) === false;
|
76
|
+
});
|
77
|
+
|
78
|
+
if (isEmptyActions) {
|
79
|
+
return;
|
80
|
+
} // 默认 context
|
81
|
+
|
82
|
+
|
74
83
|
var defaultContext = {
|
75
84
|
action: actionRef.current,
|
76
85
|
rowSelection: rowSelection
|