@teamix/pro 1.1.39 → 1.1.40
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/README.md +14 -10
- package/dist/pro.css +1 -1
- package/dist/pro.js +2214 -4073
- package/dist/pro.min.css +1 -1
- package/dist/pro.min.js +1 -1
- package/es/actions/dialog-form.d.ts +5 -5
- package/es/actions/dialog-form.js +1 -5
- package/es/actions/dialog.d.ts +6 -3
- package/es/actions/dialog.js +12 -5
- package/es/actions/index.d.ts +54 -47
- package/es/actions/index.js +28 -22
- package/es/actions/index.scss +17 -2
- package/es/card/index.d.ts +17 -5
- package/es/card/index.js +16 -11
- package/es/form/Components/ProField/index.d.ts +1 -78
- package/es/form/Components/ProField/index.js +34 -40
- package/es/form/Filter/index.js +2 -2
- package/es/form/ProForm/index.d.ts +2 -2
- package/es/form/ProForm/index.js +1 -6
- package/es/form/ProForm/index.scss +19 -1
- package/es/form/ProForm/useFieldRequest.d.ts +5 -0
- package/es/form/ProForm/useFieldRequest.js +26 -0
- package/es/form/SchemaForm/adapterDecorator.js +2 -2
- package/es/form/SchemaForm/index.d.ts +2 -2
- package/es/form/SchemaForm/index.js +12 -21
- package/es/form/SchemaForm/initializeArrayCards.d.ts +2 -2
- package/es/form/SchemaForm/initializeArrayCollapse.d.ts +2 -2
- package/es/form/SchemaForm/initializeArrayItems.d.ts +2 -2
- package/es/form/SchemaForm/initializeArrayTable.d.ts +2 -2
- package/es/form/SchemaForm/initializeDataSource.d.ts +2 -2
- package/es/form/SchemaForm/initializeDataSource.js +2 -2
- package/es/form/SchemaForm/initializeFormButton.d.ts +2 -2
- package/es/form/SchemaForm/initializeFormCollapse.d.ts +2 -2
- package/es/form/SchemaForm/initializeFormGroup.d.ts +2 -2
- package/es/form/SchemaForm/initializeFormStep.d.ts +3 -3
- package/es/form/SchemaForm/initializeFormTab.d.ts +2 -2
- package/es/form/SchemaForm/initializeRequest.d.ts +2 -2
- package/es/form/SchemaForm/initializeRequest.js +2 -2
- package/es/form/SchemaForm/initializeRules.js +44 -16
- package/es/form/SchemaForm/reactions.d.ts +5 -5
- package/es/form/SchemaForm/reactions.js +20 -18
- package/es/form/fieldTypeMap.d.ts +4 -0
- package/es/form/fieldTypeMap.js +41 -0
- package/es/form/index.d.ts +92 -4
- package/es/form/index.js +18 -5
- package/es/form/schemaNameMap.js +3 -0
- package/es/form/typing.d.ts +44 -21
- package/es/form/utils.d.ts +3 -1
- package/es/form/utils.js +38 -1
- package/es/form/warning.d.ts +2 -2
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/info/components/InfoGroup/index.js +73 -15
- package/es/info/components/InfoGroup/index.scss +45 -3
- package/es/info/components/InfoValueItem/index.js +6 -4
- package/es/info/components/InfoValueItem/index.scss +5 -1
- package/es/info/components/ProInfoItem/index.js +3 -3
- package/es/info/components/ProInfoItem/index.scss +1 -0
- package/es/info/components/baseInfo/index.d.ts +2 -3
- package/es/info/components/headerInfo/index.d.ts +2 -3
- package/es/info/components/tableInfo/index.d.ts +2 -3
- package/es/info/components/tableInfo/index.js +2 -2
- package/es/info/index.js +52 -49
- package/es/info/typing.d.ts +52 -36
- package/es/info/utils/index.d.ts +2 -2
- package/es/info/utils/utils.d.ts +1 -1
- package/es/nocode/pages/renderer.js +2 -2
- package/es/page-header/index.d.ts +34 -21
- package/es/page-header/index.js +39 -30
- package/es/page-header/index.scss +2 -1
- package/es/table/components/EmptyContent/index.d.ts +2 -0
- package/es/table/components/EmptyContent/index.js +11 -0
- package/es/table/components/Filter/index.d.ts +2 -2
- package/es/table/components/Filter/index.js +16 -8
- package/es/table/components/Layout/index.js +2 -2
- package/es/table/components/QuickAction/index.d.ts +2 -2
- package/es/table/components/QuickAction/index.js +3 -3
- package/es/table/components/ToolBar/Fullscreen.js +1 -0
- package/es/table/index.js +76 -14
- package/es/table/index.scss +4 -0
- package/es/table/typing.d.ts +27 -14
- package/es/table/utils/columnRender.d.ts +3 -3
- package/es/table/utils/columnRender.js +2 -2
- package/es/table/utils/genProColumnToColumn.d.ts +2 -2
- package/es/table/utils/genProColumnToColumn.js +1 -1
- package/es/table/utils/index.js +33 -11
- package/es/templates/List/index.d.ts +2 -2
- package/es/utils/message.d.ts +3 -0
- package/es/utils/message.js +19 -0
- package/lib/actions/dialog-form.d.ts +5 -5
- package/lib/actions/dialog-form.js +1 -5
- package/lib/actions/dialog.d.ts +6 -3
- package/lib/actions/dialog.js +13 -5
- package/lib/actions/index.d.ts +54 -47
- package/lib/actions/index.js +37 -30
- package/lib/actions/index.scss +17 -2
- package/lib/card/index.d.ts +17 -5
- package/lib/card/index.js +18 -12
- package/lib/form/Components/ProField/index.d.ts +1 -78
- package/lib/form/Components/ProField/index.js +32 -38
- package/lib/form/Filter/index.js +2 -2
- package/lib/form/ProForm/index.d.ts +2 -2
- package/lib/form/ProForm/index.js +1 -7
- package/lib/form/ProForm/index.scss +19 -1
- package/lib/form/ProForm/useFieldRequest.d.ts +5 -0
- package/lib/form/ProForm/useFieldRequest.js +37 -0
- package/lib/form/SchemaForm/adapterDecorator.js +4 -2
- package/lib/form/SchemaForm/index.d.ts +2 -2
- package/lib/form/SchemaForm/index.js +11 -22
- package/lib/form/SchemaForm/initializeArrayCards.d.ts +2 -2
- package/lib/form/SchemaForm/initializeArrayCollapse.d.ts +2 -2
- package/lib/form/SchemaForm/initializeArrayItems.d.ts +2 -2
- package/lib/form/SchemaForm/initializeArrayTable.d.ts +2 -2
- package/lib/form/SchemaForm/initializeDataSource.d.ts +2 -2
- package/lib/form/SchemaForm/initializeDataSource.js +2 -2
- package/lib/form/SchemaForm/initializeFormButton.d.ts +2 -2
- package/lib/form/SchemaForm/initializeFormCollapse.d.ts +2 -2
- package/lib/form/SchemaForm/initializeFormGroup.d.ts +2 -2
- package/lib/form/SchemaForm/initializeFormStep.d.ts +3 -3
- package/lib/form/SchemaForm/initializeFormTab.d.ts +2 -2
- package/lib/form/SchemaForm/initializeRequest.d.ts +2 -2
- package/lib/form/SchemaForm/initializeRequest.js +1 -1
- package/lib/form/SchemaForm/initializeRules.js +41 -13
- package/lib/form/SchemaForm/reactions.d.ts +5 -5
- package/lib/form/SchemaForm/reactions.js +22 -20
- package/lib/form/fieldTypeMap.d.ts +4 -0
- package/lib/form/fieldTypeMap.js +48 -0
- package/lib/form/index.d.ts +92 -4
- package/lib/form/index.js +17 -31
- package/lib/form/schemaNameMap.js +3 -0
- package/lib/form/typing.d.ts +44 -21
- package/lib/form/utils.d.ts +3 -1
- package/lib/form/utils.js +43 -1
- package/lib/form/warning.d.ts +2 -2
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/info/components/InfoGroup/index.js +76 -14
- package/lib/info/components/InfoGroup/index.scss +45 -3
- package/lib/info/components/InfoValueItem/index.js +5 -3
- package/lib/info/components/InfoValueItem/index.scss +5 -1
- package/lib/info/components/ProInfoItem/index.js +2 -2
- package/lib/info/components/ProInfoItem/index.scss +1 -0
- package/lib/info/components/baseInfo/index.d.ts +2 -3
- package/lib/info/components/headerInfo/index.d.ts +2 -3
- package/lib/info/components/tableInfo/index.d.ts +2 -3
- package/lib/info/components/tableInfo/index.js +1 -1
- package/lib/info/index.js +51 -48
- package/lib/info/typing.d.ts +52 -36
- package/lib/info/utils/index.d.ts +2 -2
- package/lib/info/utils/utils.d.ts +1 -1
- package/lib/nocode/pages/renderer.js +1 -1
- package/lib/page-header/index.d.ts +34 -21
- package/lib/page-header/index.js +37 -28
- package/lib/page-header/index.scss +2 -1
- package/lib/table/components/EmptyContent/index.d.ts +2 -0
- package/lib/table/components/EmptyContent/index.js +25 -0
- package/lib/table/components/Filter/index.d.ts +2 -2
- package/lib/table/components/Filter/index.js +16 -8
- package/lib/table/components/Layout/index.js +1 -1
- package/lib/table/components/QuickAction/index.d.ts +2 -2
- package/lib/table/components/QuickAction/index.js +1 -1
- package/lib/table/components/ToolBar/Fullscreen.js +1 -0
- package/lib/table/index.js +77 -14
- package/lib/table/index.scss +4 -0
- package/lib/table/typing.d.ts +27 -14
- package/lib/table/utils/columnRender.d.ts +3 -3
- package/lib/table/utils/columnRender.js +1 -1
- package/lib/table/utils/genProColumnToColumn.d.ts +2 -2
- package/lib/table/utils/genProColumnToColumn.js +2 -2
- package/lib/table/utils/index.js +33 -11
- package/lib/templates/List/index.d.ts +2 -2
- package/lib/utils/message.d.ts +3 -0
- package/lib/utils/message.js +32 -0
- package/package.json +4 -4
- package/es/form/Components/Search/index.d.ts +0 -11
- package/es/form/Components/Search/index.js +0 -89
- package/es/form/SchemaForm/initializeArrayIcon.d.ts +0 -3
- package/es/form/SchemaForm/initializeArrayIcon.js +0 -62
- package/es/form/SchemaForm/initializeProField.d.ts +0 -5
- package/es/form/SchemaForm/initializeProField.js +0 -70
- package/es/info/utils/useInfoRequest.d.ts +0 -14
- package/es/info/utils/useInfoRequest.js +0 -76
- package/lib/form/Components/Search/index.d.ts +0 -11
- package/lib/form/Components/Search/index.js +0 -103
- package/lib/form/SchemaForm/initializeArrayIcon.d.ts +0 -3
- package/lib/form/SchemaForm/initializeArrayIcon.js +0 -73
- package/lib/form/SchemaForm/initializeProField.d.ts +0 -5
- package/lib/form/SchemaForm/initializeProField.js +0 -77
- package/lib/info/utils/useInfoRequest.d.ts +0 -14
- package/lib/info/utils/useInfoRequest.js +0 -85
@@ -4,45 +4,45 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
4
4
|
|
5
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
6
|
|
7
|
-
import { isFn, doCommonRequest } from '@teamix/utils'; // 配置请求
|
7
|
+
import { isFn, isPlainObj, doCommonRequest } from '@teamix/utils'; // 配置请求
|
8
8
|
|
9
|
-
var
|
9
|
+
var $request = function $request(requestConfig) {
|
10
10
|
return function (field) {
|
11
|
-
var _field$
|
11
|
+
var _field$data;
|
12
12
|
|
13
|
+
var refresh = field === null || field === void 0 ? void 0 : (_field$data = field.data) === null || _field$data === void 0 ? void 0 : _field$data.refresh;
|
13
14
|
var beforeRequest = requestConfig.beforeRequest,
|
14
15
|
onSuccess = requestConfig.onSuccess;
|
16
|
+
var refreshResult = isPlainObj(refresh) ? refresh : {};
|
15
17
|
var beforeRequestResult = isFn(beforeRequest) ? beforeRequest(field) : {};
|
16
18
|
return doCommonRequest(_objectSpread(_objectSpread({}, requestConfig), {}, {
|
17
|
-
params: _objectSpread(_objectSpread({}, requestConfig.params), beforeRequestResult),
|
19
|
+
params: _objectSpread(_objectSpread(_objectSpread({}, requestConfig.params), beforeRequestResult), refreshResult),
|
18
20
|
beforeRequest: function beforeRequest() {
|
19
21
|
return beforeRequestResult;
|
20
22
|
},
|
21
23
|
onSuccess: isFn(onSuccess) ? function (res) {
|
22
24
|
return onSuccess(res, field);
|
23
25
|
} : onSuccess
|
24
|
-
}),
|
25
|
-
$self: field,
|
26
|
-
$form: field === null || field === void 0 ? void 0 : field.form,
|
27
|
-
$values: field === null || field === void 0 ? void 0 : (_field$form = field.form) === null || _field$form === void 0 ? void 0 : _field$form.values
|
28
|
-
});
|
26
|
+
}), field);
|
29
27
|
};
|
30
28
|
}; // 配置校验
|
31
29
|
|
32
30
|
|
33
|
-
var
|
34
|
-
return function (value) {
|
35
|
-
|
36
|
-
|
31
|
+
var $validator = function $validator(services, onComplete) {
|
32
|
+
return function (value, rules, _ref) {
|
33
|
+
var field = _ref.field;
|
34
|
+
return services(field).then(function (res) {
|
35
|
+
return onComplete && onComplete(res, field);
|
37
36
|
});
|
38
37
|
};
|
39
38
|
}; // 配置DataSource
|
40
39
|
|
41
40
|
|
42
|
-
var
|
41
|
+
var $dataSource = function $dataSource(services, onComplete) {
|
43
42
|
return function (field) {
|
44
43
|
field.setState({
|
45
|
-
loading: true
|
44
|
+
loading: true,
|
45
|
+
readOnly: true
|
46
46
|
});
|
47
47
|
return services(field).then(function (res) {
|
48
48
|
var _res$map;
|
@@ -55,15 +55,17 @@ var useAsyncDataSource = function useAsyncDataSource(services, onComplete) {
|
|
55
55
|
};
|
56
56
|
field.setState(_objectSpread({
|
57
57
|
dataSource: res,
|
58
|
-
loading: false
|
58
|
+
loading: false,
|
59
|
+
readOnly: false
|
59
60
|
}, clearValue));
|
60
61
|
return onComplete && onComplete(res, field);
|
61
62
|
}).catch(function () {
|
62
63
|
field.setState({
|
63
|
-
loading: false
|
64
|
+
loading: false,
|
65
|
+
readOnly: false
|
64
66
|
});
|
65
67
|
});
|
66
68
|
};
|
67
69
|
};
|
68
70
|
|
69
|
-
export {
|
71
|
+
export { $request, $dataSource, $validator };
|
@@ -0,0 +1,41 @@
|
|
1
|
+
var fieldTypeMap = {
|
2
|
+
Input: 'text',
|
3
|
+
Password: 'password',
|
4
|
+
TextArea: 'textArea',
|
5
|
+
NumberPicker: 'number',
|
6
|
+
Percent: 'percent',
|
7
|
+
Money: 'money',
|
8
|
+
Select: 'select',
|
9
|
+
MultipleSelect: 'multipleSelect',
|
10
|
+
TreeSelect: 'treeSelect',
|
11
|
+
Cascader: 'cascader',
|
12
|
+
MultipleCascader: 'multipleCascader',
|
13
|
+
ArbitraryCascader: 'arbitraryCascader',
|
14
|
+
Radio: 'radio',
|
15
|
+
Checkbox: 'checkbox',
|
16
|
+
Switch: 'switch',
|
17
|
+
DatePicker: 'date',
|
18
|
+
TimePicker: 'time',
|
19
|
+
DateTimePicker: 'dateTime',
|
20
|
+
WeekPicker: 'dateWeek',
|
21
|
+
MonthPicker: 'dateMonth',
|
22
|
+
YearPicker: 'dateYear',
|
23
|
+
QuarterPicker: 'dateQuarter',
|
24
|
+
DateRangePicker: 'dateRange',
|
25
|
+
TimeRangePicker: 'timeRange',
|
26
|
+
DateTimeRangePicker: 'dateTimeRange',
|
27
|
+
WeekRangePicker: 'dateWeekRange',
|
28
|
+
MonthRangePicker: 'dateMonthRange',
|
29
|
+
YearRangePicker: 'dateYearRange',
|
30
|
+
QuarterRangePicker: 'dateQuarterRange',
|
31
|
+
Transfer: 'transfer',
|
32
|
+
ColorPicker: 'color',
|
33
|
+
ColorRadio: 'colorRadio',
|
34
|
+
IconPicker: 'icon',
|
35
|
+
JsonInput: 'json',
|
36
|
+
TagPicker: 'tagPicker',
|
37
|
+
MultipleTagPicker: 'multipleTagPicker',
|
38
|
+
Range: 'range',
|
39
|
+
Search: 'search'
|
40
|
+
};
|
41
|
+
export default fieldTypeMap;
|
package/es/form/index.d.ts
CHANGED
@@ -6,17 +6,105 @@ export * from './typing';
|
|
6
6
|
* 使用别名导出formily相关内容
|
7
7
|
*/
|
8
8
|
export * as formilyCore from '@formily/core';
|
9
|
-
export * as formilyReact from '@formily/react';
|
10
9
|
export * as formilyReactive from '@formily/reactive';
|
11
10
|
export * as formilyTeamix from '@teamix/formily';
|
11
|
+
import * as originalFormilyReact from '@formily/react';
|
12
|
+
declare const formilyReact: {
|
13
|
+
useFieldRequest: () => {
|
14
|
+
refresh: () => void;
|
15
|
+
field: any;
|
16
|
+
};
|
17
|
+
useFormDisplayValues: () => any;
|
18
|
+
Schema: typeof originalFormilyReact.Schema;
|
19
|
+
FormProvider: import("react").FC<originalFormilyReact.IProviderProps>;
|
20
|
+
FormConsumer: import("react").FC<originalFormilyReact.IFormSpyProps>;
|
21
|
+
ArrayField: {
|
22
|
+
<D extends originalFormilyReact.JSXComponent, C extends originalFormilyReact.JSXComponent>(props: originalFormilyReact.IFieldProps<D, C, import("@formily/core").ArrayField<any, any>>): JSX.Element;
|
23
|
+
displayName: string;
|
24
|
+
};
|
25
|
+
ObjectField: {
|
26
|
+
<D_1 extends originalFormilyReact.JSXComponent, C_1 extends originalFormilyReact.JSXComponent>(props: originalFormilyReact.IFieldProps<D_1, C_1, import("@formily/core").ObjectField<any, any>>): JSX.Element;
|
27
|
+
displayName: string;
|
28
|
+
};
|
29
|
+
VoidField: {
|
30
|
+
<D_2 extends originalFormilyReact.JSXComponent, C_2 extends originalFormilyReact.JSXComponent>(props: originalFormilyReact.IVoidFieldProps<D_2, C_2, import("@formily/core").VoidField<any, any, any>>): JSX.Element;
|
31
|
+
displayName: string;
|
32
|
+
};
|
33
|
+
RecursionField: import("react").FC<originalFormilyReact.IRecursionFieldProps>;
|
34
|
+
createSchemaField<Components extends originalFormilyReact.SchemaReactComponents>(options?: originalFormilyReact.ISchemaFieldReactFactoryOptions<Components> | undefined): {
|
35
|
+
<Decorator extends originalFormilyReact.JSXComponent, Component extends originalFormilyReact.JSXComponent>(props: originalFormilyReact.ISchemaFieldProps<Decorator, Component, import("@formily/core").ObjectField<Decorator, Component>>): JSX.Element;
|
36
|
+
displayName: string;
|
37
|
+
Markup: {
|
38
|
+
<Decorator_1 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "displayName" | "defaultProps" | "propTypes" | "contextTypes">>, Component_1 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "displayName" | "defaultProps" | "propTypes" | "contextTypes">>>(props: originalFormilyReact.ISchemaMarkupFieldProps<Components, Component_1, Decorator_1>): JSX.Element;
|
39
|
+
displayName: string;
|
40
|
+
};
|
41
|
+
String: {
|
42
|
+
<Decorator_2 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "displayName" | "defaultProps" | "propTypes" | "contextTypes">>, Component_2 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "displayName" | "defaultProps" | "propTypes" | "contextTypes">>>(props: originalFormilyReact.ISchemaTypeFieldProps<Components, Component_2, Decorator_2>): JSX.Element;
|
43
|
+
displayName: string;
|
44
|
+
};
|
45
|
+
Object: {
|
46
|
+
<Decorator_3 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "displayName" | "defaultProps" | "propTypes" | "contextTypes">>, Component_3 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "displayName" | "defaultProps" | "propTypes" | "contextTypes">>>(props: originalFormilyReact.ISchemaTypeFieldProps<Components, Component_3, Decorator_3>): JSX.Element;
|
47
|
+
displayName: string;
|
48
|
+
};
|
49
|
+
Array: {
|
50
|
+
<Decorator_4 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "displayName" | "defaultProps" | "propTypes" | "contextTypes">>, Component_4 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "displayName" | "defaultProps" | "propTypes" | "contextTypes">>>(props: originalFormilyReact.ISchemaTypeFieldProps<Components, Component_4, Decorator_4>): JSX.Element;
|
51
|
+
displayName: string;
|
52
|
+
};
|
53
|
+
Boolean: {
|
54
|
+
<Decorator_5 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "displayName" | "defaultProps" | "propTypes" | "contextTypes">>, Component_5 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "displayName" | "defaultProps" | "propTypes" | "contextTypes">>>(props: originalFormilyReact.ISchemaTypeFieldProps<Components, Component_5, Decorator_5>): JSX.Element;
|
55
|
+
displayName: string;
|
56
|
+
};
|
57
|
+
Date: {
|
58
|
+
<Decorator_6 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "displayName" | "defaultProps" | "propTypes" | "contextTypes">>, Component_6 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "displayName" | "defaultProps" | "propTypes" | "contextTypes">>>(props: originalFormilyReact.ISchemaTypeFieldProps<Components, Component_6, Decorator_6>): JSX.Element;
|
59
|
+
displayName: string;
|
60
|
+
};
|
61
|
+
DateTime: {
|
62
|
+
<Decorator_7 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "displayName" | "defaultProps" | "propTypes" | "contextTypes">>, Component_7 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "displayName" | "defaultProps" | "propTypes" | "contextTypes">>>(props: originalFormilyReact.ISchemaTypeFieldProps<Components, Component_7, Decorator_7>): JSX.Element;
|
63
|
+
displayName: string;
|
64
|
+
};
|
65
|
+
Void: {
|
66
|
+
<Decorator_8 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "displayName" | "defaultProps" | "propTypes" | "contextTypes">>, Component_8 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "displayName" | "defaultProps" | "propTypes" | "contextTypes">>>(props: originalFormilyReact.ISchemaTypeFieldProps<Components, Component_8, Decorator_8>): JSX.Element;
|
67
|
+
displayName: string;
|
68
|
+
};
|
69
|
+
Number: {
|
70
|
+
<Decorator_9 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "displayName" | "defaultProps" | "propTypes" | "contextTypes">>, Component_9 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "displayName" | "defaultProps" | "propTypes" | "contextTypes">>>(props: originalFormilyReact.ISchemaTypeFieldProps<Components, Component_9, Decorator_9>): JSX.Element;
|
71
|
+
displayName: string;
|
72
|
+
};
|
73
|
+
};
|
74
|
+
Field: {
|
75
|
+
<D_3 extends originalFormilyReact.JSXComponent, C_3 extends originalFormilyReact.JSXComponent>(props: originalFormilyReact.IFieldProps<D_3, C_3, import("@formily/core").Field<any, any, any, any>>): JSX.Element;
|
76
|
+
displayName: string;
|
77
|
+
};
|
78
|
+
FormContext: import("react").Context<import("@formily/core").Form<any>>;
|
79
|
+
FieldContext: import("react").Context<import("@formily/core").GeneralField>;
|
80
|
+
SchemaMarkupContext: import("react").Context<originalFormilyReact.Schema<any, any, any, any, any, any, any, any, any>>;
|
81
|
+
SchemaContext: import("react").Context<originalFormilyReact.Schema<any, any, any, any, any, any, any, any, any>>;
|
82
|
+
SchemaExpressionScopeContext: import("react").Context<any>;
|
83
|
+
SchemaOptionsContext: import("react").Context<originalFormilyReact.ISchemaFieldReactFactoryOptions<any>>;
|
84
|
+
ContextCleaner: ({ children }: {
|
85
|
+
children: any;
|
86
|
+
}) => any;
|
87
|
+
mapProps<T extends originalFormilyReact.JSXComponent>(...args: originalFormilyReact.IStateMapper<import("react").ComponentProps<T>>[]): (target: T) => import("react").MemoExoticComponent<import("react").FunctionComponent<any>>;
|
88
|
+
mapReadPretty<T_1 extends originalFormilyReact.JSXComponent, C_4 extends originalFormilyReact.JSXComponent>(component: C_4, readPrettyProps?: import("react").ComponentProps<C_4> | undefined): (target: T_1) => import("react").MemoExoticComponent<import("react").FunctionComponent<{
|
89
|
+
ref?: import("react").RefAttributes<any> | undefined;
|
90
|
+
}>>;
|
91
|
+
connect<T_2 extends originalFormilyReact.JSXComponent>(target: T_2, ...args: originalFormilyReact.IComponentMapper<T_2>[]): import("react").ForwardRefExoticComponent<import("react").PropsWithoutRef<Partial<import("react").ComponentProps<T_2>>> & import("react").RefAttributes<unknown>>;
|
92
|
+
observer: typeof originalFormilyReact.observer;
|
93
|
+
Observer: import("react").MemoExoticComponent<import("react").FunctionComponent<import("@formily/reactive-react").IObserverProps>>;
|
94
|
+
useForm: <T_3 extends object = any>() => import("@formily/core").Form<T_3>;
|
95
|
+
useField: <T_4 = import("@formily/core").GeneralField>() => T_4;
|
96
|
+
useParentForm: () => import("@formily/core").Form<any> | import("@formily/core").ObjectField<any, any>;
|
97
|
+
useFieldSchema: () => originalFormilyReact.Schema<any, any, any, any, any, any, any, any, any>;
|
98
|
+
useFormEffects: (effects?: ((form: import("@formily/core").Form<any>) => void) | undefined) => void;
|
99
|
+
};
|
100
|
+
export { formilyReact };
|
12
101
|
/**
|
13
|
-
* 导出常用formily
|
102
|
+
* 导出常用formily内容
|
14
103
|
*/
|
15
104
|
import { createForm, registerValidateRules as registerRules, registerValidateFormats as registerFormats, registerValidateLocale, setValidateLanguage } from '@formily/core';
|
16
105
|
import { FormConsumer, useForm } from '@formily/react';
|
17
106
|
import { FormDialog, FormDrawer, FormStep, FormTab, FormCollapse } from '@teamix/formily';
|
18
|
-
|
19
|
-
export { createForm, FormConsumer, FormDialog, FormDrawer, FormStep, FormTab, FormCollapse, registerRules, registerFormats, registerValidateLocale, setValidateLanguage, useForm, useFormDisplayValues, };
|
107
|
+
export { createForm, FormConsumer, FormDialog, FormDrawer, FormStep, FormTab, FormCollapse, registerRules, registerFormats, registerValidateLocale, setValidateLanguage, useForm, };
|
20
108
|
/**
|
21
109
|
* 导出 Filter 组件
|
22
110
|
*/
|
package/es/form/index.js
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
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; }
|
2
|
+
|
3
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { 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
|
+
|
1
7
|
/**
|
2
8
|
* 导出ProForm的TS
|
3
9
|
*/
|
@@ -8,21 +14,28 @@ export * from './typing';
|
|
8
14
|
|
9
15
|
import * as _formilyCore from '@formily/core';
|
10
16
|
export { _formilyCore as formilyCore };
|
11
|
-
import * as _formilyReact from '@formily/react';
|
12
|
-
export { _formilyReact as formilyReact };
|
13
17
|
import * as _formilyReactive from '@formily/reactive';
|
14
18
|
export { _formilyReactive as formilyReactive };
|
15
19
|
import * as _formilyTeamix from '@teamix/formily';
|
16
20
|
export { _formilyTeamix as formilyTeamix };
|
21
|
+
import * as originalFormilyReact from '@formily/react';
|
22
|
+
import useFormDisplayValues from './ProForm/useFormDisplayValues';
|
23
|
+
import useFieldRequest from './ProForm/useFieldRequest';
|
24
|
+
|
25
|
+
var formilyReact = _objectSpread(_objectSpread({}, originalFormilyReact), {}, {
|
26
|
+
useFieldRequest: useFieldRequest,
|
27
|
+
useFormDisplayValues: useFormDisplayValues
|
28
|
+
});
|
29
|
+
|
30
|
+
export { formilyReact };
|
17
31
|
/**
|
18
|
-
* 导出常用formily
|
32
|
+
* 导出常用formily内容
|
19
33
|
*/
|
20
34
|
|
21
35
|
import { createForm, registerValidateRules as registerRules, registerValidateFormats as registerFormats, registerValidateLocale, setValidateLanguage } from '@formily/core';
|
22
36
|
import { FormConsumer, useForm } from '@formily/react';
|
23
37
|
import { FormDialog, FormDrawer, FormStep, FormTab, FormCollapse } from '@teamix/formily';
|
24
|
-
|
25
|
-
export { createForm, FormConsumer, FormDialog, FormDrawer, FormStep, FormTab, FormCollapse, registerRules, registerFormats, registerValidateLocale, setValidateLanguage, useForm, useFormDisplayValues };
|
38
|
+
export { createForm, FormConsumer, FormDialog, FormDrawer, FormStep, FormTab, FormCollapse, registerRules, registerFormats, registerValidateLocale, setValidateLanguage, useForm };
|
26
39
|
/**
|
27
40
|
* 导出 Filter 组件
|
28
41
|
*/
|
package/es/form/schemaNameMap.js
CHANGED
package/es/form/typing.d.ts
CHANGED
@@ -2,33 +2,36 @@ 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
|
-
|
5
|
+
interface AnyObject {
|
6
6
|
[propName: string]: any;
|
7
7
|
}
|
8
8
|
declare type FieldDisplayTypes = 'none' | 'hidden' | 'visible';
|
9
|
-
export
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
9
|
+
export interface ProFormInitializeItem {
|
10
|
+
(item: ProFormSchemaItem, props?: any): ProFormSchemaItem;
|
11
|
+
}
|
12
|
+
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 IButtonComponent = 'Submit' | 'Reset';
|
14
|
+
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';
|
15
|
+
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';
|
16
|
+
export interface ProFormRequestConfig extends CommonRequestConfig {
|
14
17
|
beforeRequest?: (field?: any) => any;
|
15
18
|
onSuccess?: (res?: any, field?: any) => any;
|
16
19
|
onComplete?: (res?: any, field?: any) => any;
|
17
20
|
}
|
18
|
-
export interface
|
21
|
+
export interface ProFormSchemaItem {
|
19
22
|
type?: string;
|
20
23
|
name?: string;
|
21
24
|
description?: React.ReactNode;
|
22
25
|
title?: string;
|
23
26
|
component?: IBaseComponent | IButtonComponent | IComboComponent | ILayoutComponent | 'ProField' | any;
|
24
|
-
props?:
|
27
|
+
props?: AnyObject | any;
|
25
28
|
decorator?: string | null;
|
26
|
-
decoratorProps?:
|
27
|
-
dataSource?: any[] |
|
29
|
+
decoratorProps?: AnyObject;
|
30
|
+
dataSource?: any[] | string | ProFormRequestConfig;
|
28
31
|
reactions?: any;
|
29
32
|
rules?: any;
|
30
|
-
items?:
|
31
|
-
children?:
|
33
|
+
items?: ProFormSchemaItem;
|
34
|
+
children?: ProFormSchemaItem[];
|
32
35
|
content?: any;
|
33
36
|
tooltip?: string;
|
34
37
|
required?: boolean;
|
@@ -40,30 +43,50 @@ export interface IFormSchemaItem {
|
|
40
43
|
readPretty?: boolean | string;
|
41
44
|
pattern?: FieldPatternTypes;
|
42
45
|
default?: any;
|
43
|
-
request?:
|
44
|
-
|
45
|
-
export declare type IFormSchema = IFormSchemaItem[];
|
46
|
-
export interface IInitializeItem {
|
47
|
-
(item: IFormSchemaItem, props?: any): IFormSchemaItem;
|
46
|
+
request?: ProFormRequestConfig;
|
47
|
+
data?: AnyObject;
|
48
48
|
}
|
49
|
-
export
|
49
|
+
export declare type ProFormSchema = ProFormSchemaItem[];
|
50
|
+
export interface ProFormProps extends IFormLayoutProps {
|
50
51
|
form?: FormType | false;
|
51
|
-
schema:
|
52
|
+
schema: ProFormSchema;
|
52
53
|
scope?: any;
|
53
54
|
components?: {
|
54
55
|
[key: string]: React.FC | React.ComponentClass;
|
55
56
|
};
|
56
57
|
children?: React.ReactNode;
|
57
|
-
initialValues?:
|
58
|
+
initialValues?: AnyObject;
|
58
59
|
initialRequest?: CommonRequestConfig;
|
59
60
|
previewTextPlaceholder?: ReactNode;
|
60
61
|
onChange?: (values: any, displayValues?: any) => any;
|
61
62
|
onSubmit?: ((values: any) => any) | CommonRequestConfig;
|
62
63
|
onSubmitFailed?: (feedbacks: IFormFeedback[]) => void;
|
63
64
|
}
|
64
|
-
export interface
|
65
|
+
export interface QueryFilterProps extends ProFormProps {
|
66
|
+
onFilter?: (values: any) => void;
|
67
|
+
onReset?: (payload?: any) => void;
|
68
|
+
}
|
69
|
+
/**
|
70
|
+
* 兼容性导出
|
71
|
+
*/
|
72
|
+
export interface IFilterProps extends ProFormProps {
|
65
73
|
triggerType?: 'keydown' | 'change' | 'submit';
|
66
74
|
onFilter?: (values: any) => void;
|
67
75
|
onReset?: (payload?: any) => void;
|
68
76
|
}
|
77
|
+
/**
|
78
|
+
* @deprecated 将在未来移除,建议使用 ProFormSchemaItem 代替
|
79
|
+
*/
|
80
|
+
export interface IFormSchemaItem extends ProFormSchemaItem {
|
81
|
+
}
|
82
|
+
/**
|
83
|
+
* @deprecated 将在未来移除,建议使用 ProFormSchema 代替
|
84
|
+
*/
|
85
|
+
export interface IFormSchema extends ProFormSchema {
|
86
|
+
}
|
87
|
+
/**
|
88
|
+
* @deprecated 将在未来移除,建议使用 ProFormProps 代替
|
89
|
+
*/
|
90
|
+
export interface IFormProps extends ProFormProps {
|
91
|
+
}
|
69
92
|
export {};
|
package/es/form/utils.d.ts
CHANGED
@@ -12,6 +12,8 @@ declare const mapSize: (props: any, field: any) => any;
|
|
12
12
|
* @returns 映射后的字段属性
|
13
13
|
*/
|
14
14
|
declare const mapStatus: (props: any, field: any) => any;
|
15
|
+
declare const mapDataSource: (props: any, field: any) => any;
|
16
|
+
declare const mapMode: (props: any, field: any) => any;
|
15
17
|
/**
|
16
18
|
* 为未配置name的字段添加随机字段名称
|
17
19
|
* @param prefix 随机字段名称前缀,默认为name
|
@@ -34,4 +36,4 @@ declare const mapSchemaName: (obj: any) => any;
|
|
34
36
|
* @returns 合并数组或合并其他值
|
35
37
|
*/
|
36
38
|
declare const mergeArrayValue: (arr: any[], v?: any) => any[];
|
37
|
-
export {
|
39
|
+
export { mapSize, mapStatus, mapDataSource, mapMode, mergeArrayValue, getRandomName, mapSchemaName, };
|
package/es/form/utils.js
CHANGED
@@ -24,6 +24,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
24
24
|
|
25
25
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
26
26
|
|
27
|
+
import { isVoidField } from '@formily/core';
|
27
28
|
import { useFormLayout, useFormShallowLayout } from '@teamix/formily';
|
28
29
|
import { isArr, isObj, getValueByValue } from '@teamix/utils';
|
29
30
|
import schemaNameMap from './schemaNameMap';
|
@@ -76,6 +77,42 @@ var mapStatus = function mapStatus(props, field) {
|
|
76
77
|
});
|
77
78
|
};
|
78
79
|
|
80
|
+
var patchDataSource = function patchDataSource() {
|
81
|
+
var dataSource = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
82
|
+
|
83
|
+
var removeEmptyChildren = function removeEmptyChildren(data) {
|
84
|
+
var result = _objectSpread({}, data);
|
85
|
+
|
86
|
+
if (!result.children || result.children.length === 0) {
|
87
|
+
delete result.children;
|
88
|
+
} else {
|
89
|
+
result.children = result.children.map(removeEmptyChildren);
|
90
|
+
}
|
91
|
+
|
92
|
+
return result;
|
93
|
+
};
|
94
|
+
|
95
|
+
return dataSource.map(removeEmptyChildren);
|
96
|
+
};
|
97
|
+
|
98
|
+
var mapDataSource = function mapDataSource(props, field) {
|
99
|
+
var _props$dataSource;
|
100
|
+
|
101
|
+
if (isVoidField(field)) {
|
102
|
+
return props;
|
103
|
+
}
|
104
|
+
|
105
|
+
return _objectSpread(_objectSpread({}, props), {}, {
|
106
|
+
dataSource: patchDataSource((_props$dataSource = props.dataSource) !== null && _props$dataSource !== void 0 ? _props$dataSource : field === null || field === void 0 ? void 0 : field.dataSource)
|
107
|
+
});
|
108
|
+
};
|
109
|
+
|
110
|
+
var mapMode = function mapMode(props, field) {
|
111
|
+
return _objectSpread(_objectSpread({}, props), {}, {
|
112
|
+
mode: (field === null || field === void 0 ? void 0 : field.readPretty) ? 'read' : 'edit'
|
113
|
+
});
|
114
|
+
};
|
115
|
+
|
79
116
|
var getRandomName = function getRandomName() {
|
80
117
|
var prefix = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'name';
|
81
118
|
return "".concat(prefix, "_").concat(Math.floor(Math.random() * Math.pow(10, 18)));
|
@@ -131,4 +168,4 @@ var mergeArrayValue = function mergeArrayValue(arr, v) {
|
|
131
168
|
return [].concat(_toConsumableArray(arr), [v]);
|
132
169
|
};
|
133
170
|
|
134
|
-
export {
|
171
|
+
export { mapSize, mapStatus, mapDataSource, mapMode, mergeArrayValue, getRandomName, mapSchemaName };
|
package/es/form/warning.d.ts
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
import type {
|
2
|
-
declare const warning:
|
1
|
+
import type { ProFormInitializeItem } from './typing';
|
2
|
+
declare const warning: ProFormInitializeItem;
|
3
3
|
export default warning;
|
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.1.
|
24
|
+
declare const version = "1.1.39";
|
25
25
|
export { version, ProAction, ProCard, ProField, ProForm, ProInfo, ProPageContainer, ProPageHeader, ProSkeleton, ProTable, hooks, nocode, templates, utils, };
|
package/es/index.js
CHANGED
@@ -25,6 +25,6 @@ export * from './page-container';
|
|
25
25
|
export * from './page-header';
|
26
26
|
export * from './skeleton';
|
27
27
|
export * from './table';
|
28
|
-
var version = '1.1.
|
28
|
+
var version = '1.1.39';
|
29
29
|
export { version, ProAction, ProCard, ProField, ProForm, ProInfo, // ProLayout,
|
30
30
|
ProPageContainer, ProPageHeader, ProSkeleton, ProTable, hooks, nocode, templates, utils };
|
@@ -1,35 +1,93 @@
|
|
1
|
-
|
1
|
+
var _excluded = ["children", "url", "method", "params", "formatResult", "onSuccess", "onError", "formatParams", "beforeRequest", "extendParams", "className", "compacted", "divider", "style", "backgroundColor"];
|
2
|
+
|
3
|
+
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; }
|
4
|
+
|
5
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { 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
|
+
import React, { isValidElement, useRef } from 'react';
|
2
14
|
import { ProInfoGroupContext } from '../../utils';
|
3
15
|
import { useSize } from '@teamix/hooks';
|
4
16
|
import './index.scss';
|
17
|
+
import cls from 'classnames';
|
18
|
+
import ProInfo from '../..';
|
5
19
|
|
6
20
|
var ProInfoGroup = function ProInfoGroup(props) {
|
7
21
|
var children = props.children,
|
8
22
|
url = props.url,
|
9
23
|
method = props.method,
|
10
24
|
params = props.params,
|
11
|
-
formatResult = props.formatResult
|
25
|
+
formatResult = props.formatResult,
|
26
|
+
onSuccess = props.onSuccess,
|
27
|
+
onError = props.onError,
|
28
|
+
formatParams = props.formatParams,
|
29
|
+
beforeRequest = props.beforeRequest,
|
30
|
+
extendParams = props.extendParams,
|
31
|
+
_props$className = props.className,
|
32
|
+
className = _props$className === void 0 ? '' : _props$className,
|
33
|
+
_props$compacted = props.compacted,
|
34
|
+
compacted = _props$compacted === void 0 ? true : _props$compacted,
|
35
|
+
_props$divider = props.divider,
|
36
|
+
divider = _props$divider === void 0 ? true : _props$divider,
|
37
|
+
style = props.style,
|
38
|
+
_props$backgroundColo = props.backgroundColor,
|
39
|
+
backgroundColor = _props$backgroundColo === void 0 ? '' : _props$backgroundColo,
|
40
|
+
others = _objectWithoutProperties(props, _excluded);
|
41
|
+
|
12
42
|
var ref = useRef();
|
13
43
|
var size = useSize(ref);
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
formatResult: formatResult
|
44
|
+
var infoType = 'infoDom';
|
45
|
+
|
46
|
+
if (Array.isArray(children)) {
|
47
|
+
if ( /*#__PURE__*/isValidElement(children === null || children === void 0 ? void 0 : children[0])) {
|
48
|
+
infoType = 'infoDomGroup';
|
49
|
+
} else {
|
50
|
+
infoType = 'infoPropsGroup';
|
22
51
|
}
|
52
|
+
}
|
53
|
+
|
54
|
+
var providerValue = {
|
55
|
+
visible: true,
|
56
|
+
size: size,
|
57
|
+
url: url,
|
58
|
+
method: method,
|
59
|
+
params: params,
|
60
|
+
formatResult: formatResult,
|
61
|
+
onSuccess: onSuccess,
|
62
|
+
onError: onError,
|
63
|
+
formatParams: formatParams,
|
64
|
+
beforeRequest: beforeRequest,
|
65
|
+
extendParams: extendParams
|
66
|
+
};
|
67
|
+
var proInfoClassName = cls({
|
68
|
+
'teamix-pro-info-group-item': true,
|
69
|
+
'teamix-pro-info-group-item-divider': divider
|
70
|
+
});
|
71
|
+
return /*#__PURE__*/React.createElement(ProInfoGroupContext.Provider, {
|
72
|
+
value: providerValue
|
23
73
|
}, /*#__PURE__*/React.createElement("div", {
|
24
|
-
className: "teamix-pro-info-group",
|
74
|
+
className: "teamix-pro-info-group ".concat(backgroundColor, " ").concat(className),
|
75
|
+
style: style,
|
25
76
|
ref: ref
|
26
|
-
},
|
77
|
+
}, infoType === 'infoDomGroup' && (children === null || children === void 0 ? void 0 : children.map(function (item, index) {
|
27
78
|
return /*#__PURE__*/React.createElement("div", {
|
28
|
-
className:
|
79
|
+
className: proInfoClassName,
|
29
80
|
key: index
|
30
81
|
}, item);
|
31
|
-
})),
|
32
|
-
|
82
|
+
})), infoType === 'infoPropsGroup' && (children === null || children === void 0 ? void 0 : children.map(function (item, index) {
|
83
|
+
return /*#__PURE__*/React.createElement("div", {
|
84
|
+
className: proInfoClassName,
|
85
|
+
key: index
|
86
|
+
}, /*#__PURE__*/React.createElement(ProInfo, _objectSpread({
|
87
|
+
compacted: compacted
|
88
|
+
}, item)));
|
89
|
+
})), infoType === 'infoDom' && /*#__PURE__*/React.createElement("div", {
|
90
|
+
className: proInfoClassName
|
33
91
|
}, children)));
|
34
92
|
};
|
35
93
|
|